<%@ page language="java" pageEncoding="GBK"%>
<%@ page import="java.util.*,com.lexue.domain.*"%>

<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html lang="true">
<html:base/>
<head>
<title>搜索家教</title>
<meta http-equiv="content-type" content="text/html; charset=GBK" />
<meta name="description" content="Your description goes here." />
<meta name="keywords" content="your,keywords,goes,here" />
<meta name="author" content="Your Name / Original design by Andreas Viklund - http://mb5u.com" />
<link rel="stylesheet" href="andreas09_search.css" type="text/css" media="screen" />
<style type="text/css">

/* This is only a demonstration of the included colors in the andreas09 template. Don't use this file as a starting point when you use the template, use the included index.html or 2col.html instead! */

#container{background:#f0f0f0 url(img/bodybg.jpg) repeat-x;}
#mainmenu a:hover{background:#f0f0f0 url(alt-img/menuhover-purple.jpg) top left repeat-x;}
#mainmenu a.current{background:#f0f0f0 url(alt-img/menuhover-purple.jpg) top left repeat-x;}

#container_header{
	margin:0;
	background:url(img/hbanner7.jpg);
	height:180px;
}
.searchbox_mini{
font-size:11px;
width:150px;
position:relative;
top:-20px;
padding:8px;
}
.searchbox_mini  td{
padding: 2px 0px;
}
.searchbox_mini .dropdownlist{
height:13px;
width:80px;
padding:1px;
font-size:11px;
}
.searchbox_mini .price{
height:15px;
width:25px;
font-size:11px;
}
.searchbox_mini .searchbtn{
height:17px;
width:60px;
border: 1px solid #97928f;
font-size:12px;
background:#ffffff;
}
/* Green Box */

#content .greenbox {
	height:200px;
	/*border: 1px solid #000000;*/ 
	margin:0px;
	padding:0px;
	background: #FFFFFF url(images/green_bar_l.png) no-repeat right top;
}

#content .greenbox .title {
	margin:0px;
	position:relative;
	left:-3px;
	width:99%;
	height: 60px;
	background:url(images/green_bar_m.png) repeat-x top;
}

#content .greenbox .title h1 {
	height: 35px;
	margin: 0;
	padding: 15px 0 0 20px;
	background: url(images/green_bar_r.png) no-repeat left top;
	letter-spacing: -1px;
	font-size: 1.6em;
	font-weight: bold;
	color: #FFFFFF;
}

#content .greenbox .entry {
	padding: 0px;
	border-left: 1px solid #FFFFFF;
	border-right: 1px solid #FFFFFF;
}
/* Purple Box */

#content .purplebox {
	height:200px;
	/*border: 1px solid #000000;*/ 
	margin:0px;
	padding:0px;
	background: #FFFFFF url(images/purple_bar_l.png) no-repeat right top;
}

#content .purplebox .title {
	margin:0px;
	position:relative;
	left:-3px;
	width:99%;
	height: 60px;
	background:url(images/purple_bar_m.png) repeat-x top;
}

#content .purplebox .title h1 {
	height: 35px;
	margin: 0;
	padding: 15px 0 0 20px;
	background: url(images/purple_bar_r.png) no-repeat left top;
	letter-spacing: -1px;
	font-size: 1.6em;
	font-weight: bold;
	color: #FFFFFF;
}

#content .purplebox .entry {
	padding: 0px;
	border-left: 1px solid #FFFFFF;
	border-right: 1px solid #FFFFFF;
}
/* btm */
.btm {
position:relative;
top:-10px;
/*border:1px solid #000000;*/
 background: url(images/img06.gif) repeat-x left bottom; }
.btm .l { background: url(images/img07.gif) no-repeat left bottom; }
.btm .r { background: url(images/img08.gif) no-repeat right bottom; }
.btm .meta{
	display:block;
	position:relative;
	top:-5px;
	margin: 0px 0px 12px 0px;
	padding: 0px 20px;
}
.btm .compare
{
	padding-left: 20px;
	background: url(resource/jiahao.png) no-repeat left center;
	font-size: 14px;
}
.btm .reserve
{
	padding-left: 20px;
	background: url(img/msg1.png) no-repeat left center;
	font-size: 14px;
}
</style>
<script type="text/javascript">
var arrFlag = new Array();
  	arrFlag[0] = 0;
  	arrFlag[1] = 0;
  	arrFlag[2] = 0;
  	arrFlag[3] = 0;
  	var i = 0;
function addPKTeacher(id, name)
{
  list = document.getElementById("pklist");
    for(i = 0 ; i<4 ; i++)
  {
      if(arrFlag[i] == 0)
      {
         list.innerHTML += "<span id='tname" + (i+1) + "'><a class='nav sub'>" + name + "</a><a href='javascript:deletePKTeacher(" + (i+1) + ")'>删除</a><span class='hide'> | </span>";

           arrFlag[i] = 1;
           document.getElementsByName("tid"+(i+1))[0].value=id;
           break;
      }
  }
}
function deletePKTeacher(id)
{
  var n = document.getElementById('tname' + id);
  n.parentNode.removeChild(n);
  document.getElementsByName("tid"+id)[0].value="";
  arrFlag[id-1]=0;
  alert(arrFlag[id-1]);
}
</script>
</head>

<body>
<div id="container">

<div id="container_header">
<div id="sitename">
<h1>te<img src="resource/logo_180x60.jpg" width="180px" height="60px" /></h1>
</div>
</div>

<div id="mainmenu">
<ul>
<li><a href="center.jsp">个人中心</a></li>
<li><a  href="getTeacherInfo.do">我的家教信息</a></li>
<li><a href="message.do?operation=showMessage">短消息</a></li>
<li><a class="current" href="search.do?operation=loadSearch">搜索家教</a></li>
</ul>
</div>
 
<div id="wrap">

<div id="leftside">
<h1>Actions</h1>
<p>
<a class="nav active" href="index.html">搜索家教</a><span class="hide"> | </span>
<html:form action="search.do?operation=searchTeachers" method="post">
<div class="searchbox_mini">
<table width="100%" border="0" align="center">
<tbody>
	     
   <%
   	List areas = (List) request.getAttribute("areas");      	
	List subjectList = (List) request.getAttribute("subjects");   
   %>
	
<tr>
<td>科目：</td><td>
		<html:select property="subject">
      	<html:option value="">不限</html:option>      	
      	<html:option value="数学">数学</html:option>
		<html:option value="语文">语文</html:option>
		<html:option value="英语">英语</html:option>
		<html:option value="物理	">物理</html:option>
		<html:option value="化学">化学</html:option>
		<html:option value="音乐">音乐</html:option>
		<html:option value="美术">美术</html:option>
		
      	</html:select>
</td>
</tr>
<tr><td>区域：</td><td>
		<html:select property="area">
      	<html:option value="">不限</html:option>
      	<html:option value="海淀区">海淀区</html:option>
      	<html:option value="东城区">东城区</html:option>
      	<html:option value="西城区">西城区</html:option>
      	<html:option value="朝阳区">朝阳区</html:option>
      	<html:option value="丰台区">丰台区</html:option>
      	<html:option value="大兴区">大兴区</html:option>
      	
      	</html:select>
</td>
</tr>
<tr>
<td>高校：</td><td>
		<html:select property="school">
      	<html:option value="">不限</html:option>
      	<html:option value="北京大学">北京大学</html:option>
       	<html:option value="清华大学">清华大学</html:option>
      	<html:option value="人民大学">人民大学</html:option>
      	<html:option value="北京师范大学">北师大</html:option>
      	<html:option value="北京理工大学">北理工</html:option>
      	<html:option value="北京航空航天大学">北航</html:option>
      	</html:select>
	
</td>
</tr>
<tr><td>价格范围：</td><td>
	<html:text property="minPrice" styleClass="price"/> ~ <html:text property="maxPrice" styleClass="price"/>
</td>
</tr>
<tr>
<td>性别：</td><td>
		<html:select property="sex" styleClass="dropdownlist">
<html:option value="">不限</html:option>
<html:option value="male">男</html:option>
<html:option value="female">女</html:option>
</html:select>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;<html:submit value = "搜索" styleClass="searchbtn"></html:submit>
</td>
</tr>
<tr>
</tbody></table>
</div>
</html:form>
<a class="nav" href="javascript:document.forms[1].submit();">家教PK</a><span class="hide"> | </span>
<span id="pklist"></span>
    <html:form style="display:none;" action="/teacherpk.do?operation=pkTeachers" method="post">
    <html:hidden property="tid1" value=""/>
    <html:hidden property="tid2" value=""/>
    <html:hidden property="tid3" value=""/>
    <html:hidden property="tid4" value=""/></html:form>

</p>

</div>

<div id="content">

<!-- ddd -->
<% int count = 0; %>
<logic:iterate id="item" name="result" offset="start" length="page">
<%count++; %>
<%TeacherInfo teacher1 = (TeacherInfo)item; %>
<div class="<%=teacher1.getSex().equals("male")?"green":"purple" %>box">
	<div class="title"><h1><%=teacher1.getTeacherName() %></h1>
		</div>
	<div class="entry">
	<img src="upload/<%=teacher1.getImage() %>" alt="" width="139" height="180" class="left" style="width: 139px; height: 180px;"/>
	<br/><p class="intro"> 就读学校：<%=teacher1.getSchool() %></p> 
	<p class="intro"><%=teacher1.getSex().equals("male")?"男孩":"女孩" %></p>
	<p class="intro">所在城市：<%=teacher1.getCity().getCityName() %></p> 
	<p class="intro">家教区域：<%= teacher1.getArea().getAreaName() %> </p>
	<p class="intro">教学科目：<%
			Set subjects = teacher1.getSubjects();
			Iterator it = subjects.iterator();
			while(it.hasNext())
			{
				Subject s = (Subject)it.next();%>
				<%=s.getSubjectName() + "&nbsp;&nbsp;"%>
			<%}
			%></p></div>
	<div style="clear:both; height:0px; margin:0px;padding:0px;"></div>
	<hr width="100%" style="margin:0px;padding:0px;display:block;position:relative;top:-15px;"/>
	<div class="btm">
		<div class="l">
			<div class="r">
				<p class="meta">
				<form id="form<%= count %>" action="search.do?operation=toReserve" method="post">
				<input type="hidden" name="teacherId" value="<%=teacher1.getTeacherId() %>"/>
				</form>
				&nbsp;&nbsp;&nbsp;<a href="javascript:addPKTeacher(<%=teacher1.getTeacherId() %>,'<%= teacher1.getTeacherName() %>')" class="compare">比较</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<a href="javascript:document.forms[<%=count+1 %>].submit();" class="reserve">预约</a></p>
				
			</div>
		</div>
	</div>
</div>
</logic:iterate>
<logic:present name="previous">
													<a
														href="search.do?operation=searchTeachers&start=<%=request.getAttribute("previous")%>">
														上一页 </a>
												</logic:present>
<logic:present name="next">
													<a
														href="search.do?operation=searchTeachers&start=<%=request.getAttribute("next")%>">
														下一页 </a>
												</logic:present>
</div>
<div class="clearingdiv">&nbsp;</div>
</div>
</div>
<div id="footer">&copy; 2009 乐学网平台开发小组</div>
</body>
</html:html>